$(document).ready(function(){
	$('#contact-form').jqTransform();

	$("button").click(function(){

		$(".formError").hide();

	});

	var use_ajax=true;
	$.validationEngine.settings={};

	$("#contact-form").validationEngine({
		inlineValidation: false,
		promptPosition: "centerRight",
		success :  function(){use_ajax=true},
		failure : function(){use_ajax=false;}
	 })

	$("#contact-form").submit(function(e){

	
	
			if(use_ajax)
			{
				$('#loading').css('visibility','visible');
				$.post('submitb.php',$(this).serialize()+'&ajax=1',
				
					function(data){
						
						msg = '<h3>Thank you, ';
						msg = msg + $('#contact-name').val();
						msg = msg + '! Your contact information has been received. We will contact you shortly.</h3>';
						$("#contact-form").hide('slow').after(msg);
												
						$('#loading').css('visibility','hidden');
					}
				
				);
			}
			e.preventDefault();
	})

});